function dQBydLambda = QDerivatives(lambda_i, Params)
% 
% QDERIVATES - compute the derivative of the imaginary part of the effective amplitude
%     A_eff = P + i Q 
% with respect to the parameter lambda_i 
% 
% usage: dQBydLambda = QDerivatives(lambda_i, Params)
% 
% Anand Sengupta, 03 February, 2010
% 
% $Id: QDerivative.m 68 2010-01-20 21:58:45Z anand.sengupta $

 setconstants

 M 	= Params.totalMass*MSOLAR_TIME;
 eta 	= Params.eta;
 A	= Params.A;
 B	= Params.B;
 P	= Params.P;
 Q	= Params.Q;
 a1	= Params.a1;
 a2	= Params.a2;
 a3	= Params.a3;
 a4	= Params.a4;

 switch lambda_i 
	case 'M'
		dQBydM = 5*Q/(6*M);
		dQBydLambda = dQBydM;
		dQBydLambda = M * dQBydM;	% returned derivative is w.r.t log(M)

	case 'eta'
		dQBydEta = Q/(2*eta);
		dQBydLambda = dQBydEta;
		dQBydLambda = eta * dQBydEta;	% returned derivative is w.r.t log(eta)
 
	case 'A'
		if Params.isAngAvged
    		    dQBydLambda = A*Q/(A^2 + B^2);
		else
    		    dQBydLambda = a2*Q/(A*a2 + a4*B);
		end
 
	case 'B'
		if Params.isAngAvged
    		    dQBydLambda = B*Q/(A^2 + B^2);
		else
    		    dQBydLambda = a4*Q/(A*a2 + a4*B);
		end
 
	case 'a1'
		dQBydLambda = 0;
 
	case 'a2'
		if Params.isAngAvged
    		    dQBydLambda = 0;
		else
    		    dQBydLambda = A*Q/(A*a2 + a4*B);
		end

	case 'a3'
		dQBydLambda = 0;
 
	case 'a4'
		if Params.isAngAvged
    		    dQBydLambda = 0;
		else
    		    dQBydLambda = B*P/(A*a2 + a4*B);
		end
 
	case 'tc'
		dQBydLambda = 0;

 end

 return;



